//
// Created by 相开原 on 2022/3/31.
//

#ifndef I_SHOP_TYPEDEF_H
#define I_SHOP_TYPEDEF_H

enum priceMode_item {
    retail, promotion, wholesale, gift
};
enum level_item {
    good, middle, bad
};

struct time_item {
    int year, month, day;
    int hour, minute, second;
};

typedef struct data_fruitItem {
    char name[32], type[32];    //名称&品种
    double unitPrice;   //单价
    double kilo;    //数量（斤数）
    int lifetime;       //lifetime保质期
    struct time_item shelfTime; //上架时间
    struct time_item life;  //life到期时间
    enum priceMode_item mode;   //价格模式
    enum level_item level;  //质量等级
    struct data_fruitItem *next;    //指针->
} fruit;

typedef struct data_purchaseItem {
    char name[32], type[32], supplier[32]; //名称&品种&供应商
    double unitPrice, totalPrice;   //单价&总价
    double kilo;    //数量暂时按公斤数记
    struct time_item purchaseTime;  //进货时间
    struct data_purchaseItem *next; //指针->
} purchaseMessage;

typedef struct data_sellItem {//等级 顾客信息 单价/总价 销售时间
    int number; //购物件数（用以判断文件行数）
    struct data_fruitItem *head;    //链中链
    double totalPrice;  //总价
    struct time_item sellTime;  //销售时间
    char customer[64];  //消费者（会员名默认GUEST）
    struct data_sellItem *next; //指针->
} sellMessage;

typedef struct account_item {
    char username[64], password[64];
    char type;
    double money;
    struct time_item addTime;
    struct account_item *next;
} account;

// 以下为 指针链表

typedef struct pointerItem {
    double temp;
    struct data_fruitItem *p_fruit;
    struct data_purchaseItem *p_purchase;
    struct data_sellItem *p_sell;
    struct account_item *p_account;
    struct pointerItem *next;
} pointer;

//店铺信息
struct shop_item {
    char name[32];
    double startMoney, balance;
    struct time_item buildTime;
    int autoBackup;
};

#endif //I_SHOP_TYPEDEF_H
